package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.entity.NursingProject;
import com.zzyl.vo.NursingProjectVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface NursingProjectMapper {
    /**
     * 新增护理项目
     * @param nursingProject
     * @return
     */
    @Insert("INSERT INTO nursing_project (name, order_no, unit, price, image, nursing_requirement, status, create_by, create_time)  \n" +
            "  VALUES (#{name}, #{orderNo}, #{unit}, #{price}, #{image}, #{nursingRequirement}, #{status}, #{createBy}, NOW()) ")
    void insert(NursingProject nursingProject);

    /**
     * 根据ID查询护理项目
     * @param id
     * @return
     */
    @Select("SELECT * FROM nursing_project WHERE id = #{id} ")
    NursingProjectVo selectById(@Param("id") Long id);

    /**
     * 动态更新护理项目
     * @param nursingProject
     * @return
     */
    void update(NursingProject nursingProject);

    /**
     * 根据ID删除 可根据需求修改为ids 批量删除deleteBatch
     * @param id
     * @return
     */
    @Delete("DELETE FROM nursing_project WHERE id = #{id}  ")
    void deleteById(@Param("id") Long id);

    /**
     * 分页查询护理项目 参数可用DTO封装或者写明两个参数
     * @param name
     * @return
     */
    Page<NursingProjectVo> selectPage(@Param("name") String name, @Param("status") Integer status);

    /**
     * 查询所有的护理项目
     * @return
     */
    @Select("select * from nursing_project")
    List<NursingProjectVo> getAll();
}
